<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>LOG日志</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
$sns = 'renren';
$cai_table = 'cai_renren_fensi';
if(isset($_GET['cate'])){
	$cate = $_GET['cate'];
}else{
	$cate = 'chongwu';
}
include_once( 'config.php' );
$con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); 
mysql_select_db(DB_NAME,$con);
mysql_query("SET NAMES utf8");
echo "<br/><br/><table class='mytable' cellpadding='0' cellspacing='0' border='0' style='width:1200px;padding:5px'><tr><td width='15%'>发布时间</td><td width='55%'>内容</td><td  width='15%'>来自</td><td width='15%'>成功</td></tr>";
//$sql3="select * from cai_log order by id desc";
$sql="select * from cai_log where data >=".(time()-86400)." and data <= ".time()." and from_from ='".get_domain_all()."' order by id desc"; 
$result1 = mysql_query($sql);
$num_all = mysql_num_rows($result1);
echo '今日总共：'.$num_all.'个 ';

$sql2="select * from cai_log where data >=".(time()-86400)." and data <= ".time()." and success=0 and from_from ='".get_domain_all()."' order by id desc"; 
$result2 = mysql_query($sql2);
$num_all = mysql_num_rows($result2);
echo '成功：'.$num_all.'个<br/>'; 

$sql3="select count(id) as ct from ".$cai_table;
$result3 = mysql_query($sql3);
$num_all3 = mysql_fetch_array($result3);
echo '总共：'.$num_all3['ct'].'个 ';

$sql4="select count(id) as ct from ".$cai_table." where  done='0' and cate='".$cate."'"; 
$result4 = mysql_query($sql4);
$num_all4 = mysql_fetch_array($result4);
echo '没有发送：'.$num_all4['ct'].'个<br/>';  

$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
    if($row['success']==1){$bakg = "style='color: red;font-weight: bold;'";}else{$bakg='';}
    echo '<tr '.$bakg.'><td>'.date("Y-m-d H:i:s",$row['data']).'</td><td>'.$row['content'].'</td><td>'.$row['from'].'</td><td>'.$row['success'].'</td></tr>';
}
echo "</table>";
?>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">  
    $(".mytable").find("tr:odd").css("background-color", "#DFDFDF");    
</script>
</html>
